home *** CD-ROM | disk | FTP | other *** search
- (c) Copyright 1989-1999 Amiga, Inc. All rights reserved.
- The information contained herein is subject to change without notice, and
- is provided "as is" without warranty of any kind, either expressed or implied.
- The entire risk as to the use of this information is assumed by the user.
-
-
-
- PAL and Audio
-
- Carolyn Scheppner
-
-
- To generate accurate frequencies on both NTSC and PAL Amigas, audio
- programs that calculate periods from a given frequency must use the
- appropriate clock constant on each machine. Programs can determine if they
- are running on an NTSC or PAL machine by checking GfxBase->DisplayFlags for
- the PAL or NTSC flags defined in gfxbase.h. The clock constants for period
- calculations are 3,579,545 clocks/second on an NTSC machine and 3,546,895
- clocks/second on a PAL machine. An example of an integer calculation using
- these values follows.
-
- #define NTSC_CLOCK (3579545)
- #define PAL_CLOCK (3546895)
-
- ULONG clock, clockx100, periodx10, period, hertzx10, sampleBytes;
-
- /* Check GfxBase->DisplayFlags and set clock to appropriate value
- * Set hertzx10 to 10 * desired frequency in hertz
- * Set sampleBytes to number of bytes in the one cycle waveform sample
- */
-
- clockx100 = 100 * clock;
- periodx10 = (clockx100 / hertzx10) / sampleBytes;
- /* round off */
- period = (periodx10 + 5) / 10;
-
-
-
-